<template>
	<!--单式的中间内容输入-->
	<div class="shanchu_chongfu">
		<div class="shanchu_div_bg">
			<textarea name="" rows="" v-model="shuru" type="number" cols="" onkeyup="this.value=this.value.replace(/[^\r\n0-9]/g,'');" ></textarea>
			
		</div>
		<div class="shanchu_btn">
			<span @click="quchong">删除重复号</span>
			<span @click="qingkong">清空</span>
		</div>
		<div class="shanchu_tishi">
			<p>程序会自动过滤掉不合法的号码。</p>
			<p>您也可以点击“删除重复号”按钮对输入内容进行格式化</p>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				shuru: []
			}
		},
		methods: {
			//五个一组，超出五个，把超出的用弹窗自动显示出来
			quchong() {
				/*var jiequ = this.shuru
				var shaixuan = jiequ.substring(5); //截取第五个之后的数
				var shurukuang = jiequ.substring(0, 5); //截取0-5位
				this.shuru = shurukuang; //截取之后显示的数
				console.log(shaixuan) //这是筛选之后的数*/

				var jiequ = this.shuru;
				var arrayStr = [];
				for(var i = 1; i < jiequ.length; i++) {
					var j = i * 2-5;
					arrayStr[i - 1] = jiequ.substr(j, 5);
				}
				var finalStr = arrayStr.join(",");
				this.shuru = finalStr; //截取之后显示的数
				console.log(finalStr) //这是筛选之后的数
			
				
			

			},
			//清空
			qingkong() {
				this.shuru = ''
			}
		}

	}
</script>

<style>

</style>